package com.social.util;

import com.social.pojo.Changes;

import java.util.HashMap;
import java.util.Map;

/**
 * 视图跳转工具类
 */
public class StatusUtil {

    //状态方法
    public static Map<String, Integer> status(Integer typeStatus, Integer approvalStatus) {
        HashMap<String, Integer> map = new HashMap<String, Integer>();
        //类型状态
        if (typeStatus != null) {
            map.put("typeStatus", typeStatus);
        }
        if (approvalStatus != null) {
            map.put("approvalStatus", approvalStatus);
        }
        return map;
    }

    //记录状态
    public static Changes getChanges(String deleteName, Integer id, String unitName, String phone, Integer status, String nameOfRegistrant, Changes change) {
        //判断操作成功 并且 操作人不为null执行
        if (status == 1 && nameOfRegistrant != null) {
            //设置id
            change.setId(null);
            //操作人
            change.setChangeOperator(nameOfRegistrant);
            //操作原因
            change.setOperationContent(deleteName + "的id是:" + id + " " + deleteName + "的公司是:" + unitName + " 电话是:" + phone);
        }
        return change;
    }

    //根据状态返回controller
    public static String statusController(Integer status) {
        if (status == 1) {
            return "redirect:/registraionOfCases/caseRegistrationPage?page=1&pageNum=5&status=2&typeStatus=1&approvalStatus=4";
        } else if (status == 2) {
            return "redirect:/registraionOfCases/caseRegistrationPage?page=1&pageNum=5&typeStatus=2&approvalStatus=0&status=1";
        } else if (status == 3) {
            return "redirect:/registraionOfCases/caseRegistrationPage?page=1&pageNum=5&typeStatus=3&approvalStatus=0&status=3";
        } else if (status == 4) {
            return "redirect:/registraionOfCases/caseRegistrationPage?page=1&pageNum=5&typeStatus=4&approvalStatus=0&status=4";
        } else if (status == 5) {
            return "redirect:/ultimate/selectByPage?page=1&pageNum=5&typeStatus=5&approvalStatus=0&status=5";
        } else if (status == 6) {
            return "redirect:/ultimate/selectByPage?page=1&pageNum=5&typeStatus=5&approvalStatus=1&status=6";
        } else if (status == 7) {
            return "redirect:/ultimate/selectByPage?page=1&pageNum=5&typeStatus=6&approvalStatus=1&status=7";
        } else if (status == 8) {
            return "redirect:/ultimate/selectByPage?page=1&pageNum=5&typeStatus=7&approvalStatus=1&status=8";
        } else if (status == 9) {
            return "redirect:/ultimate/selectByPage?page=1&pageNum=5&typeStatus=8&approvalStatus=1&status=9";
        } else if (status == 10) {
            return "redirect:/ultimate/selectByPage?page=1&pageNum=5&typeStatus=9&approvalStatus=1&status=10";
        } else if (status == 11) {
            return "redirect:/ultimate/selectByPage?page=1&pageNum=5&typeStatus=10&approvalStatus=1&status=11";
        } else if (status == 12) {
            return "redirect:/ultimate/selectByPage?page=1&pageNum=5&typeStatus=10&approvalStatus=3&status=12";
        } else if (status == 13) {
            return "redirect:/User/selectByUser?page=1&pageNum=5";
        } else {
            return "";
        }
    }

    //根据状态返回页面
    public static String statusYe(Integer status) {
        if (status == 1) {
            return "redirect:/daily_audit.jsp";
        } else if (status == 2) {
            return "redirect:/registrationOfCases.jsp";
        } else if (status == 3) {
            return "redirect:/special_audit.jsp";
        } else if (status == 4) {
            return "redirect:/approval.jsp";
        } else if (status == 5) {
            return "redirect:/registrationOfCases02.jsp";
        } else if (status == 6) {
            return "redirect:/new_case_management_form.jsp";
        } else if (status == 7) {
            return "redirect:/audit_ncm_form.jsp";
        } else if (status == 8) {
            return "redirect:/case_management.jsp";
        } else if (status == 9) {
            return "redirect:/notification_case_management.jsp";
        } else if (status == 10) {
            return "redirect:/pending_bank_cases.jsp";
        } else if (status == 11) {
            return "redirect:/enforcement.jsp";
        } else if (status == 12) {
            return "redirect:/registrationOfCases01.jsp";
        } else if (status == 13) {
            return "redirect:/user-Administration.jsp";
        } else if (status == 14) {
            return "redirect:/organ-Administration.jsp";
        } else if (status == 15) {
            return "redirect:/authorization-Administration.jsp";
        } else if (status == 16) {
            return "redirect:/database-Administration.jsp";
        } else {
            return "";
        }
    }
}